package com.xored.searchwt;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.PartInitException;

/**
 * @author Yuri Strot
 *
 */
public class OpenSearchViewHandler extends AbstractHandler {
	
	private static final boolean VIEW_SEARCH = false;

	/**
	 * The constructor.
	 */
	public OpenSearchViewHandler() {
	}
	
	/**
	 * the command has been executed, so extract extract the needed information
	 * from the application context.
	 */
	public Object execute(ExecutionEvent event) throws ExecutionException {
		try {
			if (VIEW_SEARCH)
				SearchView.openView().acticate();
			else {
				SearchStatusLine ssl = SearchStatusLine.getInstance();
				if (ssl != null)
					ssl.activate();
			}
		}
		catch(PartInitException e) {
			e.printStackTrace();
		}
		return null;
	}
}
